﻿namespace WMS6.Web.Analytics
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;

    public class ReceiptRptQuery : BasePage
    {
        protected Button btnSearch;
        protected DropDownList ddlDescr;
        protected DropDownList ddlExternalReceiptID;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlPoID;
        protected DropDownList ddlReceiptID;
        protected DropDownList ddlReceiptTypeOper;
        protected DropDownList ddlRma;
        protected DropDownList ddlSkuClassID;
        protected DropDownList ddlSkuID;
        protected DropDownList ddlVendorID;
        protected HtmlForm F15130;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected Label lblDescr;
        protected Label lblEndDateTime;
        protected Label lblExternalReceiptID;
        protected Label lblOwnerID;
        protected Label lblPoID;
        protected Label lblReceiptID;
        protected Label lblReceiptType;
        protected Label lblRma;
        protected Label lblSkuClassID;
        protected Label lblSkuID;
        protected Label lblStartDateTime;
        protected Label lblVendorID;
        protected MultipleSelectControl MSCReceiptType;
        protected HtmlLink mycss;
        protected Label one1;
        protected TextBox txtDescr;
        protected TextBox txtEndDateTime;
        protected TextBox txtExternalReceiptID;
        protected TextBox txtOwnerID;
        protected TextBox txtPoID;
        protected TextBox txtReceiptID;
        protected TextBox txtRma;
        protected TextBox txtSkuClassID;
        protected TextBox txtSkuID;
        protected TextBox txtStartDateTime;
        protected TextBox txtVendorID;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("ReceiptRptList.aspx", false);
        }

        private void InitDropDownLists()
        {
            base.InitQueryDDL(this.ddlReceiptID, 0);
            base.InitQueryDDL(this.ddlExternalReceiptID, 0);
            base.InitQueryDDL(this.ddlPoID, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlReceiptTypeOper, 0);
            base.InitQueryDDL(this.ddlSkuClassID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.InitQueryDDL(this.ddlDescr, 0);
            base.InitQueryDDL(this.ddlVendorID, 0);
            base.InitQueryDDL(this.ddlRma, 0);
            base.BindData2DDLBySysCode(this.MSCReceiptType, "ReceiptType");
            this.ddlReceiptTypeOper.SelectedValue = "One Of";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.InitDropDownLists();
            }
        }

        public string Descr
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDescr.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDescr.Text.Trim(), this.ddlDescr.SelectedValue);
                }
                return "";
            }
        }

        public string EndDateTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEndDateTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtEndDateTime.Text).ToString("yyyy-MM-dd") + " 23:59:59");
                }
                return "";
            }
        }

        public string ExternalReceiptID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternalReceiptID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternalReceiptID.Text.Trim(), this.ddlExternalReceiptID.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string PoID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtPoID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtPoID.Text.Trim(), this.ddlPoID.SelectedValue);
                }
                return "";
            }
        }

        public string ReceiptID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtReceiptID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtReceiptID.Text.Trim(), this.ddlReceiptID.SelectedValue);
                }
                return "";
            }
        }

        public string ReceiptType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCReceiptType.ReturnValue))
                {
                    return base.GetParamsString(this.MSCReceiptType.ReturnValue, this.ddlReceiptTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string Rma
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtRma.Text.Trim()))
                {
                    return base.GetParamsString(this.txtRma.Text.Trim(), this.ddlRma.SelectedValue);
                }
                return "";
            }
        }

        public string SkuClassID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuClassID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuClassID.Text.Trim(), this.ddlSkuClassID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuID.SelectedValue);
                }
                return "";
            }
        }

        public string StartDateTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtStartDateTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtStartDateTime.Text).ToString("yyyy-MM-dd") + " 00:00:00");
                }
                return "";
            }
        }

        public string VendorID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorID.Text.Trim(), this.ddlVendorID.SelectedValue);
                }
                return "";
            }
        }
    }
}

